<template>
  <div class="box">
    <div class="name">
      <img :src="item.user.avatarUrl" />
      <div class="right">
        <p class="uName">{{ item.user.nickname }}</p>
        <p class="time">{{ item.time | currency }}</p>
      </div>
    </div>
    <p class="content">{{ item.content }}</p>
  </div>
</template>

<script>
export default {
  props: ["item"],
  filters: {
    currency(v) {
      const date = new Date(v);
      return (
        "昨天" +
        date.getHours().toString().padStart(2, 0) +
        ":" +
        date.getMinutes().toString().padStart(2, 0)
      );
    },
  },
};
</script>

<style lang="less" scoped>
.box {
  width: 100%;
  //   height: 80px;
  border-bottom: 1px solid rgb(220, 220, 220);

  .name {
    display: flex;
    img {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      margin: 5px;
    }
    .right {
      flex: 1;
      margin-top: 5px;
      .uName {
        font-size: 15px;
      }
      .time {
        font-size: 12px;
        color: rgb(150, 150, 150);
      }
    }
  }
  .content {
    margin: 10px 0 10px 40px;
  }
}
</style>